package com.atguigu.guli.service.trade.controller.api;

import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.trade.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/trade/wx")
@Slf4j
public class ApiWxPayController {
    //微信支付接口
    @Autowired
    OrderService orderService;

    //获取wx支付二维码接口
    //获取code_url
    @GetMapping("/auth/getCodeUrl/{orderId}")
    public R getCodeUrl(@PathVariable("orderId") String orderId, HttpServletRequest request){
       return orderService.getCodeUrl(orderId,request);
    }

    //微信回调接口
   @PostMapping("/callback")
    public String callback(HttpServletRequest request){
        return orderService.callback(request);
   }
}
